﻿using System;
using System.Net;

class DownloadFile
{
    static void Main()
    {
        using (WebClient webClient = new WebClient())
        {
            Console.WriteLine("Type a file to download:");
            string webAdress = Console.ReadLine();
            //string webAdress = "http://www.devbg.org/img/Logo-BASD.jpg";

            try
            {
                webClient.DownloadFile(webAdress, "downloadedFile.jpg");
            }
            catch (ArgumentNullException)
            {
                Console.WriteLine("Not a valid URL!");                
            }
            catch (WebException)
            {
                Console.Error.WriteLine("Invalid adress");
            }
            catch (NotSupportedException)
            {
                Console.Error.WriteLine("The method has been called simultaneously on multiple threads.");
            }
            finally
            {
                Console.WriteLine("Bye bye!");
            }
        }
    }
}